// Edge Detect Interrupt Software ACW
// Joe Pardue 6/28/09

#include "libACW001.h"

void edgeDetect(void);

int main(void)
{
	init();		// Initialize the private stuff
	setup();	// Setup the public stuff

	//for(;;)		// Call loop() forever
		loop();
		
	//edgeDetect();

	return 0;	// You never get here

}



volatile int count = 0;

void setup()
{
  // setup the serial port
  //Serial.begin(9600);			// TAW
  serialBegin(9600);
  
  // say hello
  //Serial.println("Edge Detect Interrupt");	// TAW
  printf("Edge Detect Interrupt\n");
  
  // attach interrupt 0 (pin 2) to the 
  // edgeDetect function
  // run function on falling edge interrupt
  attachInterrupt(0, edgeDetect, FALLING);
}

void loop()
{
  // do nothing
}

// on each interrupt
// increment and show the count
void edgeDetect()
{
  count++;
  //Serial.print(count);		// TAW
  //Serial.println();			// TAW
  printf("%d\n", count);
}
